// 处方审核
import React from 'react';
import { Card, Row, Col, Input, Select, DatePicker, Button, message, Divider,Modal } from 'antd';
import PubilcTablePagination from './../../common/PubilcTablePagination';
import ColumnAuthoritysModel from 'pages/columnAuthority/ColumnAuthoritysModel';
import RejectPrescription from './RejectPrescription.jsx';
import store from 'store';
import './style/outpha.less';
import { $http } from 'containers/config/https';
import Moment from 'moment';
import ReadCard from 'components/readcard/ReadCard';
import PreviewOfPrescription from './common/PreviewOfPrescription.jsx';
import iconListvisits from 'assets/images/icon_listvisits.png';

const { Option } = Select;
let buttonStatus = true;
let dataLenght = 0;

let theAudio = null;
export default class PrescriptionChecking extends React.Component {

    constructor(props) {
        super(props);
        var userData = JSON.parse(sessionStorage.getItem('userData'));
        this.state = {
            userData,
            page: 1,
            pageSize: 20,
            rowId: '', // 选中行id
            total: 0,
            basicHeight: 0,
            tableData: [],
            statusSelectData: [], // 审核状态下拉框数据
            startDate: '', // 开始日期
            endDate: '', // 截止日期
            patID: '', // 病人Id
            pat: '', // 回车保存的病人id
            patNo: undefined, // 病人
            statusID: undefined, // 审核状态Id
            flag: '', // 按钮显示状况
            mainInfo: [], // 处方明细基本数据
            detailInfo: [], // 处方明细PR
            rowData: {}, // 行数据
            defaultValue: '', // 默认卡类型
            cardSlectData: [], // 卡类型下拉框数据
            cardType: undefined, // 卡类型
            cardNo: undefined, // 卡号
            loading: false,
            columns: [],
            widthTotal: 0,
            authorityStatus: false,
            audioUrl: '',
            audioNumber: 0,
            resetList: '',
            // defaultStartDate:'',//默认时间
            // defaultEndDate:''
        };
        this.columns = [
            {
                title: '状态', dataIndex: 'statusDesc', key: '1', width: '80px', align: "center",
                render(states) {
                    let config = {
                        '未审核': <span style={{ color: '#FAAD14' }}>未审核</span>,
                        '审核通过': <span style={{ color: '#007AFF' }}>审核通过</span>,
                        '审核拒绝': <span style={{ color: '#ff4d4f' }}>审核拒绝</span>,
                        '医生申诉': <span style={{ color: '#13C2C2' }}>医生申诉</span>,
                        '接受拒绝': <span style={{ color: '#FA541C' }}>接受拒绝</span>
                    }
                    return config[states];
                }
            },
            { title: '病人ID', dataIndex: 'patNo', key: '2', width: '100px', align: "center" },
            { title: '患者', dataIndex: 'patName', key: '3', width: '100px', align: "center" },
            { title: '科室', dataIndex: 'ordLocDesc', key: '4', width: '120px', align: "center" },
            { title: '处方号', dataIndex: 'ordPrescNo', key: '5', width: '120px', align: "center" },
            { title: '日期', dataIndex: 'ordDate', key: '6', width: '100px', align: "center" },
        ];
        this.myRef1 = React.createRef();
    }

    componentDidMount() {
        // let partnerKey = '8b796ede045b5f53744d8ce0554f73c8';
        // let pip = 'NHDoctor';
        // let tt = '637268523164116563'; //new Date().getTime();
        // let result =pip+tt+partnerKey;
        // let url = '/Article/ArticleWlyy/Index?drId=医生Id&drname=医生姓名&permiss=3'
        // console.log('resultresult',result)
        // console.log('MD5加密后。。',this.md5(result));
        // console.log('MD5解密后。。',this.md5('9B4038A29319681726CC54944C25A8E4'));
        // console.log('DES加密后。。', this.encryptByDES(url, partnerKey));
        // console.log('DES解密',this.decryptByDES(this.encryptByDES(url, partnerKey),partnerKey))
        this.authorityManagement();
        this.getSelectData();
        this.getCardSelectData();
        this.getMainTableColumns();
        this.setState({ basicHeight: document.getElementById("prescription-checking-basic").clientHeight }, () => {
            setTimeout(() => {
                this.myRef1.current.focus();
            }, 300)
        });
        theAudio = setInterval(() => {
            this.refreshTableData();
            this.getTableDataAudio();
        }, 30000);

        //http://dev100-207manage.e24health.com /Account/PartnerLogin?
        // pid=NHDoctor
        // tt=637268523164116563
        // signed=9B4038A29319681726CC54944C25A8E4
        // url=u7bvw4tcIr7wyHBaGZab0%2fguZWN%2f3PlzRfXm%2ffJen82gDG8vdLLesHtuhG1ueVbrTkGvEk3r0WI%3d
        // encrypt=1



    }

    componentWillUnmount() {
        // 组件销毁前将静止让setState修改state的状态
        this.setState = (state, callback) => { return; }
        clearInterval(theAudio)
    }

    //判断医生有没有审核权限
    authorityManagement = () => {
        let data = {
            params: [{
                userID: this.state.userData.userID,
                locID: this.state.userData.locID,
                authDesc: 'AuditAuth'
            }]
        }
        $http.post('urlS', this, {
            code: "02030082",
            data: data,
            success: function (res) {
                if (+res.errorCode == '02010015') {
                    // message.error(res.errorMessage);
                    this.setState({ authorityStatus: true })
                } else {
                    this.setState({ authorityStatus: false })
                }
            }
        })
    };

    // 获取数据列表columns
    getMainTableColumns = () => {
        let { userData } = this.state;
        let data = {
            params: [{
                compontName: "PrescriptionReview",
                reactCode: ['PrescriptionReview'],
                type: 'C',
            }]
        }
        $http.post('urlS', this, {
            code: '01040073',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let arr = res.result.C && res.result.C.length > 0 ? JSON.parse(JSON.stringify(res.result.C)).map((item, index) => {
                        return {
                            ...item,
                            key: index + 1,
                            title: <div onDoubleClick={() => this.mainColumnRef.onOpenModel()}>{userData.language == 'EN' ? (item && item.enDescripts ? item.enDescripts : item.title) : item.title}</div>,
                            render: (states) => {
                                if (item.dataIndex === "statusDesc") {
                                    let config = {
                                        '未审核': <span style={{ color: '#FAAD14' }}>未审核</span>,
                                        '审核通过': <span style={{ color: '#007AFF' }}>审核通过</span>,
                                        '审核拒绝': <span style={{ color: '#ff4d4f' }}>审核拒绝</span>,
                                        '医生申诉': <span style={{ color: '#13C2C2' }}>医生申诉</span>,
                                        '接受拒绝': <span style={{ color: '#FA541C' }}>接受拒绝</span>
                                    }
                                    return config[states];
                                } else {
                                    return states;
                                }
                            }
                        }
                    }) : '';
                    let filterArr = arr.filter(function (item) { return item.display === 'Y' });
                    this.setState({ columns: filterArr, widthTotal: res.totalWidth, localeProvider: userData.language == 'EN' ? res.result.language.EN : res.result.language.CN })
                }
            }
        })
    }

    onMainColumnRef = (ref) => {
        this.mainColumnRef = ref;
    }

    //国际化
    setMessage = (name, message, defaultTitle) => {
        return this.state.localeProvider && this.state.localeProvider[name] ? this.state.localeProvider[name][message] : defaultTitle
    }

    onRef = (ref) => {
        this.child = ref;
    }

    onModalRef = (ref) => {
        this.modalChild = ref;
    }

    // 操作行
    onClickRowPublic = (record) => {
        return {
            // 单击行选中
            onClick: () => {
                if (this.state.rowId === '') {
                    // 保存行数据以及ID
                    this.setState({ rowId: record.ordPrescNo, flag: record.statusID, rowData: record }, () => {
                        // 获取处方明细
                        this.getDetailData(record.ordPrescNo);
                        this.modalChild.emptyData();
                    })
                } else {
                    if (this.state.rowId !== record.ordPrescNo) {
                        this.setState({ rowId: record.ordPrescNo, flag: record.statusID, rowData: record }, () => {
                            // 获取处方明细
                            this.getDetailData(record.ordPrescNo);
                            this.modalChild.emptyData();
                        })
                    }
                }
            }
        }
    }

    // 选中行操作
    setRowClassNamePublic = (record) => {
        return record.ordPrescNo === this.state.rowId ? 'clickRowStyle' : '';
    }

    // 提供给子组件修改条数的方法
    compilePage = (page, pageSize) => {
        this.setState({ page: page, pageSize: pageSize }, () => {
            // 修改page, pageSize之后重新调用查询方法
            this.refreshTableData()
        })
    }

    // 下拉框数据查询
    getSelectData() {
        let data = {
            params: [{}]
        }
        $http.post('urlS', this, {
            code: "02030018",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result) {
                    this.setState({
                        statusSelectData: res.result, statusID: res.result[0].id,
                        startDate: res.startDate ? Moment(res.startDate, 'YYYY-MM-DD') : Moment(),
                        endDate: res.endDate ? Moment(res.endDate, "YYYY-MM-DD") : Moment(),
                    }, () => {
                        this.handleQuery();
                        this.getTableDataAudio()
                    })
                } else {
                    this.setState({ statusSelectData: [] })
                }
            }
        })
    }

    // 获取处方明细
    getDetailData(ordPrescNo) {
        let data = {
            params: [{
                ordPrescNo: ordPrescNo
            }]
        }
        $http.post('urlS', this, {
            code: "02030020",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    this.setState({ mainInfo: res.result[0].mainInfo, detailInfo: res.result[0].detailInfo })
                } else {
                    this.setState({ mainInfo: [], detailInfo: [] })
                }
            }
        })
    }

    // 按照输入条件重新查询数据
    refreshTableData = (val) => {
        let { startDate, endDate, patID, statusID } = this.state;
        this.getTableData(startDate, endDate, patID, statusID);
        // this.getTableDataAudio()
    }

    // 获取未审核数据并且提示语言
    getTableDataAudio = () => {
        let statusID = this.state.statusSelectData.filter((item) => item.descripts == '未审核');
        let { pageSize, page, startDate, endDate } = this.state;
        let data = {};
        data = {
            params: [{
                startDate: startDate ? Moment(startDate).format('YYYY-MM-DD') : Moment().format('YYYY-MM-DD'), // 开始日期
                endDate: endDate ? Moment(endDate).format('YYYY-MM-DD') : Moment().format('YYYY-MM-DD'), // 截至日期
                // patID: patID, // 病人Id
                statusID: statusID[0].id, // 审核状态Id
            }],
            pagination: [{
                pageSize: pageSize,
                currentPage: page,
                sort: "",
                dir: "Asc"
            }]
        }
        $http.post('urlS', this, {
            code: "02030019",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result && res.result.rows.length > 0) {
                    if (dataLenght !== res.result.rows.length) {
                        this.setState({ audioNumber: this.state.audioNumber + 1 }, () => {
                            if (this.state.audioNumber < 4) {
                                this.setState({
                                    audioUrl: 'https://chis.e24health.com/images/Voice/needAuditPresc.mp3',

                                }, () => {
                                    var myAuto = document.getElementById('a_player_audio');
                                    myAuto.play();
                                })
                            } else {
                                dataLenght = res.result.rows.length;
                                this.setState({
                                    audioUrl: ''
                                })
                            }

                        })
                    } else {
                        this.setState({ audioNumber: 0 })
                    }
                } else {
                    this.setState({
                        audioUrl: '',
                        audioNumber: 0
                    });
                    dataLenght = 0;
                }
            },
        })
    }

    // 获取表格数据
    getTableData = (startDate, endDate, patID, statusID) => {
        this.setState({ loading: true });
        let { pageSize, page } = this.state;
        let data = {}
        data = {
            params: [{
                startDate: startDate ? Moment(startDate).format('YYYY-MM-DD') : undefined, // 开始日期
                endDate: endDate ? Moment(endDate).format('YYYY-MM-DD') : undefined, // 截至日期
                patID: patID, // 病人Id
                statusID: statusID, // 审核状态Id
            }],
            pagination: [{
                pageSize: pageSize,
                currentPage: page,
                sort: "",
                dir: "Asc"
            }]
        }
        $http.post('urlS', this, {
            code: "02030019",
            data: data,
            success: function (res) {
                if (+res.errorCode === 0 && res.result && res.result.rows.length > 0) {
                    let tableData = res.result.rows;
                    for (var i = 0; i < tableData.length; i++) {
                        tableData[i].key = i;
                    }
                    this.setState({
                        tableData, total: res.result.total, loading: false, rowId: tableData[0].ordPrescNo, rowData: tableData[0], flag: tableData[0].statusID, patNo: undefined
                    }, () => {
                        this.getDetailData(this.state.rowId);
                        this.modalChild.emptyData();
                        // 数据加载成功关闭loading
                        this.child.handleLoading();
                        setTimeout(() => {
                            this.myRef1.current.focus();
                        }, 300)
                    })
                    // if (this.state.resetList) {
                    //     this.clearData();
                    // }
                } else {
                    this.setState({ rowId: '', flag: '', rowData: {}, mainInfo: [], detailInfo: [], tableData: [], total: 0, loading: false, patNo: undefined }, () => {
                        // message.error("未查询到数据。")
                        // 数据加载成功关闭loading
                        this.child.handleLoading();
                        setTimeout(() => {
                            this.myRef1.current.focus();
                        }, 300)
                    })

                }
            },
            error: function () {
                this.setState({ tableData: [], total: 0, loading: false, audioUrl: '', patNo: undefined }, () => {
                    // 数据加载成功关闭loading
                    this.child.handleLoading();
                    setTimeout(() => {
                        this.myRef1.current.focus();
                    }, 300)
                })
            }
        })
    }

    clearData = () => {
        this.setState({
            rowId: '', flag: '', rowData: {}, mainInfo: [], detailInfo: [], resetList: ''
        })
    }

    // 查询
    handleQuery = (event) => {
        setTimeout(() => {
            this.setState({ page: 1, resetList: event, audioNumber: 0 }, () => {
                this.refreshTableData();
            })
        }, 300)
    }

    // 查询条件 --- 开始日期
    handleStartDate = (e) => {
        this.setState({ startDate: e });
    }

    // 查询条件 --- 截止日期
    handleEndDate = (e) => {
        this.setState({ endDate: e });
    }

    // 查询条件 --- 审核状态
    handlestatusID = (e) => {
        this.setState({ statusID: e });
    }

    // 审核通过
    handleGetApproved = (child) => {
        let data = {
            params: [{
                ordPrescNo: this.state.rowId
            }]
        }
        $http.post('urlS', this, {
            code: '02030021',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    if(res.errorMessage=="请前往医网信进行签名"){
                        console.log("请前往医网信进行签名",123)
                        const modal = Modal.success({
                            title: '提示',
                            okText: '我知道了',
                            content: <div>
                                <div>{res.errorMessage}</div>
                            </div>
                        });
                    }else{
                        message.success(res.errorMessage);
                    }
                    this.clearData();
                    //this.addMessageRecordingP();  //改成后台调用发送消息
                    let { startDate, endDate, patID, statusID } = this.state;
                    this.getTableData(startDate, endDate, patID, statusID);
                    if (child === 'detail') {
                        this.modalChild.handleCancel('handle')
                    }
                    setTimeout(() => {
                        this.myRef1.current.focus();
                    }, 300)
                }
            }
        })
    };


    //新增消息记录(患者)
    addMessageRecordingP = () => {
        let { userData, rowData } = this.state;
        let data = {
            params: [{
                "sendUserName": userData.userName,
                "receiveUserName": rowData.patName,
                "eventCode": "2005",
                "sendTypeCode": "U",
                "receiveTypeCode": "P",
                "sendUser": userData.userID,
                "receiveUser": rowData.patID,
                "content": "待支付",
                "userID": "",
                "jumpPages": "pages/tabBar/order/order"
            }]
        }
        $http.post('urlS', this, {
            code: '03100096',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    // message.success('审核成功');
                    console.log(res)
                }
            }
        })
    }

    // 病人id
    handlePatientOnChange = (e) => {
        if (!e.target.value) {
            setTimeout(() => {
                this.setState({ patID: '' })
            }, 500);
        }
        if (/[^\d]/.test(e.target.value)) {
            this.setState({ patID: e.target.value })
        }
        this.setState({ patNo: e.target.value })
    }

    // 卡号
    handleCardNoChange = (e) => {
        if (!e.target.value) {
            setTimeout(() => {
                this.setState({ patID: '' })
            }, 500);
        }
        this.setState({ cardNo: e.target.value })
    }

    // 卡类型
    handleCardTypeOnChange = (e) => {
        this.setState({ cardType: e })
    }

    // 查询病人id
    handlePatient = (e, name) => {
        console.log(typeof e.target.value);

        if (!e.target.value) {
            this.setState({ patID: '' })
            return;
        }
        if (name == 'blur') {
            if (!/[^\d]/.test(e.target.value)) {
                this.setState({ cardNo: undefined, cardType: this.state.defaultValue }, () => {
                    this.getPatientInformation('patient', name);
                })
            }
        } else if (name == 'enter') {
            if (!/[^\d]/.test(e.target.value)) {
                this.setState({ cardNo: undefined, cardType: this.state.defaultValue }, () => {
                    this.getPatientInformation('patient', name);
                })
            } else {
                this.setState({ page: 1, pageSize: 10, patID: e.target.value }, () => {
                    this.refreshTableData();
                })
            }

        }
    }

    // 获取卡类型下拉框数据
    getCardSelectData = () => {
        let data = {
            params: [{}]
        }
        $http.post('urlS', this, {
            code: '02030052',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let defaultValue = '';
                    for (var i = 0; i < res.result.length; i++) {
                        if (res.result[i].defaultFlag === 'Y') {
                            defaultValue = res.result[i].id;
                        }
                    }
                    this.setState({ cardSlectData: res.result, cardType: defaultValue, defaultValue: defaultValue })
                }
            }
        })
    }

    // 3.2.1.3.13.根据卡号取病人信息
    getPatientInformation = (flag, name) => {
        let data = {
            params: [{
                number: this.state.patNo, // 病人登记号/证件号
                cardTypeID: flag === 'readCard' ? this.state.cardType : undefined, // 卡类型id
                cardNo: this.state.cardNo, // 卡号
            }]
        }
        setTimeout(() => {
            buttonStatus = true;
        }, 500)
        $http.post('urlS', this, {
            code: '03040004',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    let cardNo = flag === "readCard" && res.data && res.data.patCardNo ? res.data.patCardNo : undefined; // 给卡号赋值
                    this.setState({ patID: res.data && res.data.patID ? res.data.patID : '', cardNo }, () => {
                        if (name === 'enter') {
                            this.setState({ page: 1, pageSize: 10 }, () => {
                                this.refreshTableData();
                            })
                        }
                    })
                } else if (res.errorFlag === 'N') {
                    this.setState({ page: 1, pageSize: 10, rowId: '', tableData: [], total: 0, mainInfo: [], detailInfo: [], patID: 'aaaaa', patNo: undefined }, () => {
                        message.error(res.errorMessage)
                        setTimeout(() => {
                            this.myRef1.current.focus();
                        }, 300)
                    })

                }
            },
            error: function() {
                this.setState({ page: 1, pageSize: 10, rowId: '', tableData: [], total: 0, mainInfo: [], detailInfo: [], patID: 'aaaaa', patNo: undefined }, () => {
                    setTimeout(() => {
                        this.myRef1.current.focus();
                    }, 300)
                })
            }
        })
    }

    // 读卡 --- 根据卡号取病人信息
    handleReadCard = () => {
        if (!buttonStatus) {
            return;
        }
        let { cardType } = this.state;
        this.readCard.ReadCard(cardType, "R", (json) => {
            this.setState({ patID: json.patInfo && json.patInfo.patID ? json.patInfo.patID : 'aaaaa', cardNo: json.cardNo }, () => {
                this.setState({ page: 1, pageSize: 10 }, () => {
                    this.refreshTableData();
                })
            })
        })
    }

    handleReadCardOnBlur = (e, name) => {
        if (!e.target.value) {
            this.setState({ patID: '' })
            return;
        }
        if (name === 'blur') {
            buttonStatus = false
        }
        this.setState({ patNo: undefined }, () => {
            this.getPatientInformation('readCard', name);
        })
    };
    cancelAudit = () => {
        let data = {
            params: [{
                ordPrescNo: this.state.rowId,
            }]
        }
        $http.post('urlS', this, {
            code: '02030114',
            data: data,
            success: function (res) {
                if (+res.errorCode === 0) {
                    message.success(res.errorMessage);
                    this.handleQuery();
                    this.clearData();
                }
            }
        })
    };

    render() {
        let { startDate, endDate, patNo, statusID, flag, mainInfo, detailInfo, columns, widthTotal } = this.state;
        // 组件所需参数
        const param = {
            // 表头配置
            columns: columns && columns.length > 0 ? columns : this.columns,
            // 表格数据
            data: this.state.tableData,
            // 数据总条数
            total: this.state.total,
            // 当前页数
            page: this.state.page,
            // 表格的宽度
            x: columns && columns.length > 0 ? widthTotal : 620,
            y: store.getState().tableHeight.y + 90 - this.state.basicHeight,
            height: store.getState().tableHeight.y + 136 - this.state.basicHeight + 'px',
            isOnRow: true,
            rowClassName: true,
            TableClassName: 'table-scroll-height',
            loading: this.state.loading,
            pageSize: "20"
        };

        // 审核状态
        let auditStatus = this.state.statusSelectData && this.state.statusSelectData.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })
        // 卡类型
        let cardTypeOption = this.state.cardSlectData && this.state.cardSlectData.map((item, index) => {
            return (<Option key={index} value={item.id} title={item.descripts} seatchprop={item.descripts + '^' + item.descriptsSPCode}>{item.descripts}</Option>)
        })

        let mainInfoObj = mainInfo && mainInfo.length > 0 ? mainInfo[0] : {};
        let detailData = detailInfo && detailInfo.length > 0 ? detailInfo[0].rows : [];
        return (
            <div className="prescription-checking">
                <div style={{ display: 'node' }}>
                    <audio id="a_player_audio" src={this.state.audioUrl}></audio>
                </div>
                <Row id="prescription-checking-basic" style={{ padding: '0 24px' }}>
                    <Col span={18} className="input-padding-right">
                        <Row style={{ marginBottom: '20px' }}>
                            <Select value={this.state.cardType} onChange={this.handleCardTypeOnChange} showSearch optionFilterProp="seatchprop" allowClear placeholder={this.setMessage("PrescriptionReviewperHealthCard", "descripts", "居民健康卡")} style={{ width: '109px', margin: '22px 10px 0 0' }}>
                                {cardTypeOption}
                            </Select>
                            <Input value={this.state.cardNo} allowClear onBlur={(e) => this.handleReadCardOnBlur(e, 'blur')} onChange={this.handleCardNoChange} onPressEnter={(e) => this.handleReadCardOnBlur(e, 'enter')} placeholder={this.setMessage("PrescriptionReviewcardNumTips", "descripts", "请输入卡号(Enter)")} style={{ width: '142px', marginTop: '22px' }} />
                            <Button style={{ margin: '0 10px', background: '#007AFF', color: '#fff' }} onClick={this.handleReadCard}>{this.setMessage("PrescriptionReviewCardReading", "descripts", "读卡")}</Button>
                            <Input
                                title={this.setMessage("PrescriptionReviewenterToSeachPatID", "descripts", "回车触发病人ID查询")}
                                allowClear
                                placeholder={this.setMessage("PrescriptionReviewpatId/CardNum", "descripts", "病人ID/病人姓名(Enter)")}
                                style={{ width: '180px', margin: '22px 10px 0 0' }}
                                ref={this.myRef1}
                                value={patNo}
                                onBlur={(e) => this.handlePatient(e, 'blur')}
                                onChange={this.handlePatientOnChange}
                                onPressEnter={(e) => this.handlePatient(e, 'enter')} />
                            <div style={{ display: 'inline-block' }}>
                                <span className="d-form-label">{this.setMessage("PrescriptionReviewchargeDate", "descripts", "收费日期")}：</span>
                                <DatePicker className="d-start-date" style={{ width: '125px', marginTop: '8px' }} placeholder={this.setMessage("PrescriptionReviewstartDate", "descripts", "开始日期")} value={startDate} onChange={this.handleStartDate} allowClear={false} />
                                <span className="d-form-label form-label-date">{this.setMessage("PrescriptionReviewto", "descripts", "到")}</span>
                                <DatePicker className="d-end-date" style={{ width: '125px', marginTop: '8px' }} placeholder={this.setMessage("PrescriptionReviewdeadline", "descripts", "结束日期")} value={endDate} onChange={this.handleEndDate} />
                                <Select showSearch optionFilterProp="seatchprop" allowClear placeholder={this.setMessage("PrescriptionReviewexamineStatus", "descripts", "审核状态")} style={{ width: '125px', margin: '8px 10px 0 10px' }} value={statusID} onChange={this.handlestatusID}>
                                    {auditStatus}
                                </Select>
                                <Button type="primary" style={{ marginTop: '8px' }} onClick={() => { this.handleQuery('reset') }}>{this.setMessage("PrescriptionReviewsearch", "descripts", "查询")}</Button>
                            </div>
                        </Row>
                    </Col>
                    <Col span={6} style={{ textAlign: 'right' }}>
                        <Button
                            type="primary"
                            style={{ marginTop: '22px', minWidth: '100px', display: (flag === 'Before' || flag === '') ? 'inline-block' : 'none', marginRight: '10px' }}
                            onClick={this.handleGetApproved}
                            disabled={flag === '' || this.state.authorityStatus}
                        >{this.setMessage("PrescriptionReviewauditPassed", "descripts", "通过审核")}</Button>
                        <Button
                            disabled={this.state.authorityStatus}
                            style={{ marginTop: '22px', minWidth: '100px', display: flag === 'Apply' ? 'inline-block' : 'none' }}
                            onClick={() => this.modalChild.showModal(this.state.rowData, detailData)}
                        >{this.setMessage("PrescriptionReviewhandComplaint", "descripts", "处理申诉")}</Button>
                        <Button
                            disabled={this.state.authorityStatus}
                            style={{ marginTop: '22px', minWidth: '100px', display: (flag === 'No' || flag === 'Rec') ? 'inline-block' : 'none', marginRight: '10px' }}
                            onClick={() => this.modalChild.showModal(this.state.rowData, detailData)}
                        >{this.setMessage("PrescriptionReviewview", "descripts", "查看")}</Button>
                        <Button
                            type="danger"
                            style={{ margin: '22px 10px 0 0', minWidth: '100px', display: (flag === 'Before' || flag === '' || flag === 'Yes') ? 'inline-block' : 'none' }}
                            onClick={() => this.modalChild.showModal(this.state.rowData, detailData)}
                            disabled={flag === '' || this.state.authorityStatus}
                            ghost
                        >{this.setMessage("PrescriptionReviewauditRefused", "descripts", "审核拒绝")}</Button>
                        <Button
                            type="danger"
                            style={{ margin: '22px 10px 0 0', minWidth: '100px', display: (flag !== 'Before') ? 'inline-block' : 'none' }}
                            onClick={this.cancelAudit}
                            disabled={flag === '' || flag === 'Before'}
                            ghost
                        >取消审核</Button>
                    </Col>
                </Row>
                <div style={{ height: '6px', background: 'rgba(240, 242, 245, 1)', width: '100%' }}></div>
                <Row>
                    <Col span={10}>
                        <div style={{ paddingRight: '6px', position: 'relative' }}>
                            <Card
                                size="small"
                                title={<div className="card-title-left-img"><img src={iconListvisits} alt="" />{this.setMessage("PrescriptionReviewdataList", "descripts", "数据列表")}</div>}
                            >
                                <div>
                                    <PubilcTablePagination param={param} handelThis={this} onRef={this.onRef} onClickRowPublic={this.onClickRowPublic} setRowClassNamePublic={this.setRowClassNamePublic} />
                                </div>
                            </Card>
                            <div style={{ width: '6px', background: 'rgba(240, 242, 245, 1)', position: 'absolute', top: 0, right: 0, height: '100%' }}></div>
                        </div>
                    </Col>
                    <Col span={14}>
                        <Row>
                            <h1 className='RpDoctor'>
                                <Col span={5}>
                                    开单医生：{mainInfoObj.ordDocDesc}
                                </Col>
                                <Col span={6} style={{ marginLeft: '20px' }}>
                                    联系电话：{mainInfoObj.docMobile}
                                </Col>
                            </h1>
                        </Row>
                        <PreviewOfPrescription setMessage={this.setMessage} mainInfoObj={mainInfoObj} basicHeight={this.state.basicHeight} rowId={this.state.rowId} detailData={detailData} />
                    </Col>
                </Row>
                <RejectPrescription discern="PrescriptionChecking" onRef={this.onModalRef} handleThis={this} modalTitle={this.setMessage("PrescriptionReview42", "descripts", "拒绝处方单")} />
                <ReadCard ref={r => this.readCard = r} />
                <ColumnAuthoritysModel
                    clientWidth='800px'
                    compontName='PrescriptionReview'
                    configType="C"
                    onRef={this.onMainColumnRef}
                    reloadData={this.getMainTableColumns}
                />
            </div>
        )
    }
}
